#ifndef _FLIGHTCHESSBOARDSERVER_H_
#define	_FLIGHTCHESSBOARDSERVER_H_

#include <iostream>
#include <vector>
#include <boost/function.hpp>

using namespace std;

namespace model_flight_chess_board
{
	class FlightChessBoardSession
	{
	public:
		typedef boost::function<void (const char *,size_t)> sendFuncPtr;
		typedef boost::function<void ()> recvFuncPtr;
		typedef boost::function<void (uint32_t,const char *)> sendErrFuncPtr;
		FlightChessBoardSession();
		~FlightChessBoardSession();
		void Init(const char *buf,size_t len);
		void Recv();
		void Process();
		void Send(const char *buf,size_t len);
		void SendErr(uint32_t err_no,const char *err_msg_str);
		void SetFcbSessionOutputDataCallback(sendFuncPtr f)
		{
			sfp_ = f;
		}
		void SetFcbSessionInputDataCallback(recvFuncPtr f)
		{
			rfp_ = f;
		}
		void SetFcbSessionOutputErrMsgCallback(sendErrFuncPtr f)
		{
			sefp_ = f;
		}
	private:
		FlightChessBoardSession(const FlightChessBoardSession &);
		vector<uint8_t> buffer_;
		sendFuncPtr sfp_;
		recvFuncPtr rfp_;
		sendErrFuncPtr sefp_;
	};
};

#endif
